# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Dataflow.V1b3.Model.ReportWorkItemStatusRequest do
  @moduledoc """
  Request to report the status of WorkItems.

  ## Attributes

  *   `currentWorkerTime` (*type:* `DateTime.t`, *default:* `nil`) - The current timestamp at the worker.
  *   `location` (*type:* `String.t`, *default:* `nil`) - The [regional endpoint] (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that contains the WorkItem's job.
  *   `projectNumber` (*type:* `String.t`, *default:* `nil`) - Optional. The project number of the project which owns the WorkItem's job.
  *   `unifiedWorkerRequest` (*type:* `map()`, *default:* `nil`) - Untranslated bag-of-bytes WorkProgressUpdateRequest from UnifiedWorker.
  *   `workItemStatuses` (*type:* `list(GoogleApi.Dataflow.V1b3.Model.WorkItemStatus.t)`, *default:* `nil`) - The order is unimportant, except that the order of the WorkItemServiceState messages in the ReportWorkItemStatusResponse corresponds to the order of WorkItemStatus messages here.
  *   `workerId` (*type:* `String.t`, *default:* `nil`) - The ID of the worker reporting the WorkItem status. If this does not match the ID of the worker which the Dataflow service believes currently has the lease on the WorkItem, the report will be dropped (with an error response).
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :currentWorkerTime => DateTime.t() | nil,
          :location => String.t() | nil,
          :projectNumber => String.t() | nil,
          :unifiedWorkerRequest => map() | nil,
          :workItemStatuses => list(GoogleApi.Dataflow.V1b3.Model.WorkItemStatus.t()) | nil,
          :workerId => String.t() | nil
        }

  field(:currentWorkerTime, as: DateTime)
  field(:location)
  field(:projectNumber)
  field(:unifiedWorkerRequest, type: :map)
  field(:workItemStatuses, as: GoogleApi.Dataflow.V1b3.Model.WorkItemStatus, type: :list)
  field(:workerId)
end

defimpl Poison.Decoder, for: GoogleApi.Dataflow.V1b3.Model.ReportWorkItemStatusRequest do
  def decode(value, options) do
    GoogleApi.Dataflow.V1b3.Model.ReportWorkItemStatusRequest.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Dataflow.V1b3.Model.ReportWorkItemStatusRequest do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
